package com.seguriapp.entities;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.seguriapp.base.BaseEntity;

/**
 * Represents a MediaContent entity.
 * 
 * @author Tania Gonzales(taniadgv@gmail.com)
 */
@Entity
@Table(name = "MediaContent")
public class MediaContent extends BaseEntity {

  private static final long serialVersionUID = -5278674142845370483L;

  @Id
  @GeneratedValue
  private Long id;

  @Enumerated(EnumType.STRING)
  private MediaContentType type;

  private String content;

  @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
  @JoinColumn(nullable = false, name = "complaintId")
  private Complaint complaint;

  private Date createdDate;

  public Long getId() {
    return id;
  }

  public MediaContentType getType() {
    return type;
  }

  public String getContent() {
    return content;
  }

  public Complaint getComplaint() {
    return complaint;
  }

  public void setId(final Long id) {
    this.id = id;
  }

  public void setType(final MediaContentType type) {
    this.type = type;
  }

  public void setContent(final String content) {
    this.content = content;
  }

  public void setComplaint(final Complaint complaint) {
    this.complaint = complaint;
  }

  public Date getCreatedDate() {
    return createdDate;
  }

  public void setCreatedDate(final Date createdDate) {
    this.createdDate = createdDate;
  }

  public Map<String, Object> toJsonString() {
    final Map<String, Object> map = new LinkedHashMap<String, Object>();
    map.put("id", id);
    map.put("type", type);
    map.put("content", content);
    return map;
  }

}
